<?php


namespace App\Controller\Cooperative;


use App\Annotation\OperationLog;
use App\Controller\AbstractController;
use App\Request\Cooperative\ConfigOtherSaveRequest;
use App\Service\Cooperative\ConfigOtherService;
use Hyperf\Di\Annotation\Inject;

class ConfigOtherController extends AbstractController
{

    /**
     * @Inject()
     * @var ConfigOtherService
     */
    protected $configOtherService;

    /**
     * @OperationLog(event="配置中心-其他设置列表",platform="cooperative")
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function index()
    {
        $index = $this->configOtherService->index();
        return $this->response->success($index);
    }

    /**
     * @OperationLog(event="配置中心-其他设置修改",platform="cooperative")
     * @param string $name
     * @param ConfigOtherSaveRequest $request
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function save(string $name, ConfigOtherSaveRequest $request)
    {
        $return = $this->configOtherService->save($name, $request->validated());
        return $this->response->success($return);
    }

}